Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 Db refactoring #577

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

🔥 Db refactoring #577

wants to merge 11 commits into from

Conversation

iChemy
Copy link
Contributor

@iChemy iChemy commented Dec 18, 2024

データベーススキーマを少しずつ改良していきたいのでその一歩(二歩)として

Provider を埋め込んで []RoomAdminmany2many を使うことで []User に置き換えた

@iChemy iChemy requested a review from Nzt3-gh December 18, 2024 18:23
@iChemy
Copy link
Contributor Author

iChemy commented Dec 18, 2024

TODO: update room 周りの実装で整合性が取れてなさそうなので確認する

@@ -180,7 +180,7 @@ func (r *Room) BeforeSave(tx *gorm.DB) (err error) {
}

func (r *Room) BeforeUpdate(tx *gorm.DB) (err error) {
if err := tx.Model(r).Association("Admins").Clear(); err != nil {
if err := tx.Model(&Room{ID: r.ID}).Association("Admins").Clear(); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model(r) みたいなことをしていると rAdminsnil になってしまうみたい.(その仕様が書かれているドキュメントを見つけられてないが...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant